Dreamcast VMU Dreamcast VMU Programming and Tools Dreamcast VMU
Tools that I wrote
      DCI / VMI File Creator
      DCI to VMS Converter
      DCI Dreamkey File Extractor       'El Cheapo' Frame Ripper
      VMS Checksum Calculator
      LCD Animation Converter
What you need to program the VMU
      Required Tools
      The VMU Instruction Set
      Example Source Listings
      Writing your first VMU program
      Where to get additional info



Some VMU Tools that I wrote

SEGAs Visual Memory Unit (VMU for short) is a neat little platform for writing small games and doing little hardware projects. And it's easy to share them with friends over the internet or in person.

If you already are into Dreamcast VMU Programming and want some helpful tools that create .VMI and .DCI files for you or that convert .DCI files back into .VMS files, then have a look at my self-programmed stuff here:

DCI / VMI File Creator v1.3
dci_vmi.zip
German Version
 
dci_vmi.zip
English Version
This little program lets you create .DCI files (that can then be uploaded into the Nexus 4x Memory Card) and .VMI files that are needed to download .VMS files from webpages directly into the Visual Memory Unit of your Dreamcast (type the program name without any parameter to get additional info).

This version now also supports files with more than 128 blocks.

DCI to VMS Converter v1.3
dci2vms.zip
German Version
 
dci2vms.zip
English Version
This little program converts .DCI files (for the Nexus 4x Memory Card) back into .VMS files (type the program name without any parameter to get additional info).

This version now also supports files with more than 128 blocks.

DCI Dreamkey File Extractor v0.1 beta
dci2file.zip
German Version
 
dci2file.zip
English Version
You can use this to extract Internet Downloads from .DCI files (images that have been saved with Dreamkey and copied to your PC with the Nexus 4x Memory Card).

This is a 'beta' release, so I guarantee for nothing. ;) I only made this program because someone from France requested it, since he can access the internet via the Dreamcast only (oh, the poor guy), but wanted to use the images that he saves while online on his PC too.

Note: you can NOT decode Dreamcast Mail Attachments with this tool!

For more information about the Nexus 4x Memory Card, please go to http://www.hkems.com (there you can also get the software to up-/download stuff from and to the card).

'El Cheapo' Frame Ripper
ripit.zip
German Version
 
ripit.zip
English Version
When writing VMU programs, don't you too find it quite hard to create the binary image data that you later copy to the LCD screen? With this neat little tool it's a piece of cake. You can now simply create all your images with VMU Animator (see http://www.vmudev.org/) or Dream Animator (see http://www.booyaka.com/), safe your work as an .LCD file and then use Frame Ripper to extract the frames that you need. They will be saved as plain text, ready-to-be-included into your source file.
VMS Checksum Calculator v1.1
vms_crc.zip
German Version
 
vms_crc.zip
English Version
Many Dreamcast Save Game files contain a CRC checksum to prevent manipulation of its data. This small program calculates the new checksum value for you. Simply run it after you are done with modifying your Save Game data, and the new CRC value is written into the file.

This version now also supports files with more than 128 blocks.

LCD Animation Converter v1.0
lcd_anim.zip
German Version
 
lcd_anim.zip
English Version
A simple program that converts .LCD animations into .VMS files that can then be run on a VMU like a normal game (type the program name without any parameter to get additional info). Also creates a matching animated GIF image that can be used on webpages.

Unlike booyaka's Online LCD Converter, this one does not support any 'special features' like screen inverting, slide effects, selective displaying of frames, button checking, and so on. Anyone who wants such things should IMHO try to write real VMU programs instead of just playing with LCD animations. Also, I think that at least some stuff should be reserved for those who are willing to invest the time and effort to learn VMU programming... if everything were made so easy that even an idiot can use it, then all we would get in the end is stuff made by idiots, right? ;)

BTW, anyone else around who ever programmed GIF LZW compression in assembler like me? ;)

Contents List




What you need to program the VMU

The CPU in SEGAs Visual Memory Unit is a customized Sanyo microcontroller which is code compatible with the LC86000 series. This means that you have to write your VMU programs in assembler, 'LC86000 Assembler' to be exact. Also, you need to know how a VMU game file is organized (Header Data, Interrupt Vectors, Header Icons etc.) and how the VMU hardware works (LCD-Screen, Flash Rom, Special Function Registers etc.).

I can't give a 'full course' about how to program games for the VMU here, but I can try to help newcomers a little to get started...

First you need an Assembler (the program that makes a VMU game file out of your source listing) and a VMU Emulator (to test-run your program on your PC).

A DOS / Windows version of Marcus Comstedt's VMU assembler can be downloaded from

http://www.tidalwave.net/~maushammer/vmuasm.exe
To use the assembler, simply type
VMUASM  [-i<include_directory>]  <sourcefile>
This program also needs a file called 'SFR.I' to recognize all Special Function Registers and PSW bits. If it wasn't included in your copy of the assembler, then you can download it here.

For additional help, simply type "vmuasm -h". After compiling your source file, you should end up with a file called <sourcefile>.VMS. This is the output file, suitable for use with the VMU emulator, or if you build an appropriate .VMI file and put it on a properly configured website, you can get it into an actual VMU.

A DOS / Windows version of Marcus Comstedt's VMU Emulator (called DOS SoftVMS, ported by Colm Cox) can be downloaded from

http://www.fortunecity.com/skyscraper/wav/1190/dl_exe.html
It runs full-screen or in a DOS box under Windows and emulates most of VMU hardware, which is enough to run all known SEGA games. There is no sound support yet, but hopefully that will soon be added too.

To run a game, simply type

VMS <game_filename>
There is also a VMU disassembler (a program that can make source listings out of a .VMS game file, so you can have a look at the code) available at
http://www.tidalwave.net/~maushammer/LCdis.exe
The disassembler takes machine-readable code and turns it into a human-readable format, which is very useful for analyzing programs.

Features:

For additional info how to use the Assembler, Disassembler and Emulator, go to

http://www.tidalwave.net/~maushammer/vmu.html



Ok... once you have those programs and know how to use them, the next step is to learn the Instruction Set of the VMU CPU (the assembler instructions that you must use in your source listing, forming the actual program). Detailled info about the VMU Hardware and its Instruction Set is available at Marcus Comstedt's site. Among other stuff, Marcus also wrote the VMU assembler & emulator, and made the first game with publicly available source code, called Tiny Tetris. The URL is
http://marcus.mangakai.org/dc/
Choose 'software' for programming info. Most notably are the explanations of addressing modes & the CPU Instruction Set and about the VMU Special Function Registers & the LCD Frame Buffer (especially the latter is important to be able to display stuff on the screen). I suggest saving the pages to disk and printing them, so you have something to refer to if you get stuck. :)



Now, before you can actually start programming, you should first try to work through the source listing from someone else and try to understand what it does (you can learn a whole lot from reading other people's source code, and it also helps you getting familiar with the usage of the instruction set).

A sample source listing of a VMU Tetris game is available at

http://marcus.mangakai.org/dc/files/tetris.s
I suggest you start with the Tetris source, it's the same one I used to learn it. The code is pretty well documented, and most other programs use functions from this code too.

A sample VMU Pong (Breakout) source listing is available at

http://www.tidalwave.net/~maushammer/bounce.s
A sample VMU Scroll demo (scrolling text) is available at
http://www.virtuamunstaz.de/scroll.s
Look at every line of program code, try to understand what it does and write it behind the code as a comment (even when it's something obvious), for example

    MOV  #$01,ACC
ST  B
MOV  #$0,XBNK
;  move value $01 into ACC register
;  move contents of ACC register into B register
;  set XBANK-register to 0 (this selects memory
;  bank 0 of the LCD frame buffer)

I know that this can be quite hard and time-consuming, but believe me, it's the best way to learn it. :) I suggest you start with a simple routine like 'CLRSCR' (which clears the screen of the VMU by writing bytes with the value $00 to the LCD frame buffer). Understanding how to address the LCD is one of THE most important things in VMU programming.

BTW, everything following a ; or * character is considered a comment by the assembler and is ignored.



Finally, once you know the basics and worked through enough code to be able to understand what it actually does, you can try to write your own stuff. Here I also suggest that you don't try to write a program from scratch, but instead use an existing source listing as 'skeleton' for your program. This saves you the trouble of creating a file header with all its interrupt vectors, or a button checking routine. Keep what you can use, delete what you don't need, and write the rest yourself. :)

For your convenience, you can download my

Example Source Skeleton
This is a fully-documented and easy-to-understand source sample with explains everything about the basic VMU program structure that you need to know. Also note that even though its only meant to serve demonstratic purposes, it's also a ready-to-compile program, so you can run it through the VMU assembler right on the spot and test it, if you want (although all it does is clearing the screen and then displaying the message "Hello World").



If you want to learn more about VMU programming or have any interesting questions, then check out the message boards at
http://www.booyaka.com
You can also go to the VMU development mailinglist at
http://www.egroups.com/group/vmu-dev/
That's where most people interested in writing stuff for the VMU appear to be gathering. Also, it has been noted that Sega engineer Alexander Villagran is working on getting the official VMU development tools released to hobbyists. Let's wait and see if he succeeds.

There is also an 'Unofficial VMU FAQ' available at

http://rvmu.port5.com/faq.html
Phew. ;) That's it so far... more stuff will be added at a later time.

Contents List


Back to the Main Page.